/*
 * DisplayLuaText.java
 * Created on December 24, 2007, 4:24 AM by Uru
 *
 * Gets text from lua and draws it
 * Unlike the majority of these objects, its y is the bottom of the line rather than the top
 */

package MenuSystem;

import java.awt.*;
import javax.swing.*;
import LuaSystem.LuaEngine;

public class DisplayLuaText implements SelfDrawing{
    Color color;
    String var;     //name of the lua variable to watch
    Font font;
    
    //Creates a new instance of colored DisplayText
    public DisplayLuaText(String t, Font f, Color c){
        color = c;
        var = t;
        font = f;
    }
    
    //draws the text
    public void draw(Graphics2D g, int mx, int my, JComponent screen){
        g.setColor(color);
        g.setFont(font);
        String text = LuaEngine.getGlobalString(var);
        if(text != null){
            g.drawString(text,mx,my);
        }
    }
}
